package com.baijia.web.util;

import com.baijia.commons.lang.utils.PropertiesReader;
import org.springframework.beans.factory.annotation.Value;

import java.util.Properties;

/**
 * Created by dudu on 16/7/13.
 */
public class ThirdLoginUtil {

    /** 新浪微博 */
    public static String WEIBO_CLIENT_ID;

    public static String WEIBO_CLIENT_SECRET;

    public static String WEIBO_ACCESS_TOKEN_URL;

    public static String WEIBO_REDIRECT_URL;

    public static String WEIBO_USER_INFO_URL;


    /** QQ */
    public static String QQ_CLIENT_ID;

    public static String QQ_CLIENT_SECRET;

    public static String QQ_ACCESS_TOKEN_URL;

    public static String QQ_REDIRECT_URL;

    public static String QQ_OPENID_URL;

    public static String QQ_USER_INFO_URL;

    /** ALIPAY */
    public static String ALIPAY_CLIENT_ID;

    public static String ALIPAY_CLIENT_SECRET;

    public static String ALIPAY_ACCESS_TOKEN_URL;

    public static String ALIPAY_REDIRECT_URL;

    public static String ALIPAY_USER_INFO_URL;

    /** BAIDU */
    public static String BAIDU_CLIENT_ID;

    public static String BAIDU_CLIENT_SECRET;

    public static String BAIDU_ACCESS_TOKEN_URL;

    public static String BAIDU_REDIRECT_URL;

    /** RENREN */
    public static String RENREN_CLIENT_ID;

    public static String RENREN_CLIENT_SECRET;

    public static String RENREN_ACCESS_TOKEN_URL;

    public static String RENREN_REDIRECT_URL;

    /** WECHAT */
    public static String WECHAT_CLIENT_ID;

    public static String WECHAT_CLIENT_SECRET;

    public static String WECHAT_ACCESS_TOKEN_URL;

    public static String WECHAT_REDIRECT_URL;

    public static String WECHAT_USER_INFO_URL;


    static {
        Properties prop = PropertiesReader.getProperties("thirdLogin.properties");
        if (prop != null) {
            WEIBO_CLIENT_ID = prop.getProperty("weibo.client_id");
            WEIBO_CLIENT_SECRET = prop.getProperty("weibo.client_secret");
            WEIBO_ACCESS_TOKEN_URL = prop.getProperty("weibo.access_token_url");
            WEIBO_REDIRECT_URL = prop.getProperty("weibo.redirect_uri");
            WEIBO_USER_INFO_URL = prop.getProperty("weibo.userInfo_url");

            QQ_CLIENT_ID = prop.getProperty("qq.client_id");
            QQ_CLIENT_SECRET = prop.getProperty("qq.client_secret");
            QQ_ACCESS_TOKEN_URL = prop.getProperty("qq.access_token_url");
            QQ_REDIRECT_URL = prop.getProperty("qq.redirect_uri");
            QQ_OPENID_URL = prop.getProperty("qq.openid_url");
            QQ_USER_INFO_URL = prop.getProperty("qq.userInfo_url");


            ALIPAY_CLIENT_ID = prop.getProperty("alipay.client_id");
            ALIPAY_CLIENT_SECRET = prop.getProperty("alipay.client_secret");
            ALIPAY_ACCESS_TOKEN_URL = prop.getProperty("alipay.access_token_url");
            ALIPAY_REDIRECT_URL = prop.getProperty("alipay.redirect_uri");
            ALIPAY_USER_INFO_URL = prop.getProperty("alipay.userInfo_url");

            BAIDU_CLIENT_ID = prop.getProperty("baidu.client_id");
            BAIDU_CLIENT_SECRET = prop.getProperty("baidu.client_secret");
            BAIDU_ACCESS_TOKEN_URL = prop.getProperty("baidu.access_token_url");
            BAIDU_REDIRECT_URL = prop.getProperty("baidu.redirect_uri");

            RENREN_CLIENT_ID = prop.getProperty("renren.client_id");
            RENREN_CLIENT_SECRET = prop.getProperty("renren.client_secret");
            RENREN_ACCESS_TOKEN_URL = prop.getProperty("renren.access_token_url");
            RENREN_REDIRECT_URL = prop.getProperty("renren.redirect_uri");

            WECHAT_CLIENT_ID = prop.getProperty("wechat.client_id");
            WECHAT_CLIENT_SECRET = prop.getProperty("wechat.client_secret");
            WECHAT_ACCESS_TOKEN_URL = prop.getProperty("wechat.access_token_url");
            WECHAT_REDIRECT_URL = prop.getProperty("wechat.redirect_uri");
            WECHAT_USER_INFO_URL = prop.getProperty("wechat.userInfo_url");

        }
    }
}
